using System;
using SimpleServiceBus.Bus;
using SimpleServiceBus.Endpoint.Metadata;
using SimpleServiceBus.Utilities;

namespace SimpleServiceBus.Endpoint
{
    public interface IMessagingEndpoint : IBackgroundService
    {
        IMessageBus MessageBus { get; }
        EndpointServiceManager LocalServices { get; }

        EndpointDescription Metadata { get; set; }

        event EventHandler<EndpointEventArgs> EndpointOnline;
        event EventHandler<EndpointOfflineEventArgs> EndpointOffline;

        void TakeEndpointOffline(string reason, TimeSpan outageDuration);
        void Restart(string reason);
    }
}